<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: wangxiaoping
  Date: 2024/8/25
  Time: 6:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<h1>这是page2页面，欢迎光临</h1>
名字：<%=request.getParameter("username")%>
年龄：<%=request.getParameter("age")%>
<hr/>
<form method="get" action="page2.jsp">
    <input type="text" name="username" value="${param.username}"/>
    <input type="text" name="score" value="${param.score}"/>
    <input type="submit" value="登录"/>
</form>
<c:if test="${param.username=='admin'}" var="isAdmin" scope="application">
    <c:out value="管理员欢迎您"/>
</c:if>
<c:out value="${isAdmin}"/>
<hr/>
<c:set value="${param.score}" var="score"/>
<c:choose>
<c:when test="${score>=90}">成绩优秀</c:when>
<c:when test="${score>=80}">成绩良好</c:when>
<c:when test="${score>=70}">成绩一般</c:when>
<c:when test="${score<=60}">不及格</c:when>
</c:choose>

<hr/>
<%
//    ArrayList<String> people = new ArrayList<>();
//    people.add(0,"张三");
//    people.add(1,"李四");
//    people.add(2,"王五");
//    people.add(3,"赵六");
//    people.add(4,"田七");
//    request.setAttribute("list",people);
    ArrayList<String> people = new ArrayList<>();
    people.add(0,"张三");
    people.add(1,"李四");
    people.add(2,"王五");
    people.add(3,"赵六");
    people.add(4,"田七");
    request.setAttribute("list",people);
%>
<%--<c:forEach var="people" items="list">--%>
<%--    <c:out value="${people}"/><br/>--%>
<%--</c:forEach>--%>

<c:forEach var="people" items="${list}">
    <c:out value="${people}"/> <br>
</c:forEach>
<hr/>
<c:forEach var="people" items="${list}" begin="0" end="4" step="2">
    <c:out value="${people}"/><br/>
</c:forEach>
</body>
</html>
